package com.alex.controller;


import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import static com.alex.controller.SelectJournalTitle.*;


@SuppressWarnings("ALL")
@Component
@Slf4j
public class InitController implements CommandLineRunner {

    public static Map<String, Map<Integer, Integer>> keyWordJidTiKwAbSumMap = new ConcurrentHashMap<>();
    public static Map<String, Map<Integer, Integer>> keyWordJidSumMap = new ConcurrentHashMap<>();
    Map<Integer, String> jidAndJournalMap = new ConcurrentHashMap<>();
    String limit = "";

    int onePageNum = 1000;
    String database = "ai_study_240923.";

    String keyWordJidSumTable = database + "key_word_jid_sum";
    Set<String> prepositionsSet = SelectJournalTitle.getPrepositionsSet();
    int nowYear = getNowYear();

    @Override
    public void run(String... args) throws Exception {
        System.out.println("读表开始");
        SelectJournalTitle.readTable(keyWordJidSumTable, onePageNum, limit, "id", "map`,`key_word", true, 10, keyWordJidTiKwAbSumMap, nowYear, keyWordJidSumTable, "memory", keyWordJidSumMap, jidAndJournalMap, prepositionsSet);
        System.out.println("读表结束");
    }


}
